package com.v5ba.encryptserver.common;

public class RespUtil {

    public static ResponseVO success(){
        return success(null);
    }
    public static ResponseVO success(Object data){
        ResponseVO responseVO = new ResponseVO();
        responseVO.setCode(ResponseVO.SUCCESS_CODE);
        responseVO.setMsg(ResponseVO.SUCCESS_MSG);
        responseVO.setData(data);
        return responseVO;
    }
    public static ResponseVO fail(String code, String msg){
        ResponseVO responseVO = new ResponseVO();
        responseVO.setCode(code);
        responseVO.setMsg(msg);
        return responseVO;
    }
    public static ResponseVO fail(String msg){
        ResponseVO responseVO = new ResponseVO();
        responseVO.setCode(ResponseVO.FAIL_CODE);
        responseVO.setMsg(msg);
        return responseVO;
    }
    public static boolean isSuccess(ResponseVO responseVO){
        return ResponseVO.SUCCESS_CODE.equals(responseVO.getCode());
    }
}
